import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.util.*;

public class test28 {


        public static void main(String[] args) throws IOException {
            List<String> list = FileUtils.readLines(new File("a.txt"), "UTF-8");
            HashMap<Integer,Integer> map= new HashMap<>();
            for (String s : list) {
                String[] sb = s.split("=");
                map.put(Integer.parseInt(sb[0]),Integer.parseInt(sb[1])+2);
            }
            List<Map.Entry<Integer,Integer>> list1  = new ArrayList<>(map.entrySet());
            Collections.sort(list1, new Comparator<Map.Entry<Integer, Integer>>() {
                @Override
                public int compare(Map.Entry<Integer, Integer> o1, Map.Entry<Integer, Integer> o2) {
                    return o1.getKey()-o2.getKey();
                }
            });
            byte[] bts  = new byte[list.size()];
            List<Byte> bytes = new ArrayList<>();
            for (Map.Entry<Integer, Integer> entry : list1) {
                byte b = entry.getValue().byteValue();
                bytes.add(b);
            }
            for (int i = 0; i <bytes.size() ; i++) {
                bts[i]=bytes.get(i);
            }
            FileUtils.writeByteArrayToFile(new File("a.jpg"),bts,false);
            System.out.println("ok");
        }
    }

